import pandas as pd

data = [1, 2, 3, 4, 5, 6]
index = ["a", "b", "c", "d", "e", "f"]
series = pd.Series(data, index=index, name="A")

# 1.Series类 基本方法
print("数据:",series.values)
print("索引:",series.index)
print("数据类型:",series.dtype)
print("索引类型:",series.index.dtype)
print("名称:",series.name)
print("长度:",series.size)

""" 
数据: [1 2 3 4 5 6]
索引: Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object')
数据类型: int64
索引类型: object
名称: A
长度: 6
"""

# 2.Series类 数据查看
print("查看前3行:",series.head(3))
print("查看后3行:",series.tail(3))
print("查看 指定索引的值:",series.loc["c"])
print("查看 指定索引: ", series[0:2])
""" 
查看前3行: a    1
b    2
c    3
Name: A, dtype: int64

查看后3行: d    4
e    5
f    6
Name: A, dtype: int64

查看 指定索引的值: 3

查看 指定索引:  a    1
b    2
Name: A, dtype: int64
"""